<?php $this->placeholder('container-class')->set('post_ad job')?>
<?php $this->JQuery()->javascriptCaptureStart()?>
jQuery(function() {
    $j('#add_more_btn').click(function() {
        if ($j('#add_more_checkbox').attr('value') == 1) {
            $j('#add_more_checkbox').attr('value',0);
        }
        else {
            $j('#add_more_checkbox').attr('value',1);
        }
        $j('#add_more').toggle();
        return false;
    });

    if ($j('#add_more_checkbox').attr('value') == 0) {
        $j('#add_more').show();
    }
    else {
        $j('#add_more').hide();
    }

    // Control for Title
    $j('input#title').keydown(function(event) {
        var charLength = 100 - $j(this).val().length;
        if (charLength <0) {
            if ( event.keyCode == 8 || event.keyCode == 46 ) {

            } else {
                return false;
            }
        }
        else {
            $j('span#counter_title').html('<em>'+charLength + '</em> <?php echo $this->t('characters remaining')?>');
        }
    });

    // Control for description
    $('textarea#description').keydown(function(event) {
        var charLength = 3000 - $(this).val().length;
        if (charLength <0) {
            if ( event.keyCode == 8 || event.keyCode == 46 ) {

            } else {
                return false;
            }
        }
        else {
            $('span#counter_description2').html('<em>'+charLength + '</em> <?php echo $this->t('characters remaining')?>');
        }
    });

    $j('#preview_link').click(function() {
        var action = $j('#listing_form').attr('action');
        $j('#listing_form').attr('action', '<?php echo $this->preview_link?>');
        $j('#listing_form').attr('target','_blank');
        $j('#listing_form').submit();
        $j('#listing_form').attr('action', action);
        $j('#listing_form').attr('target','_self');
        return false;
    });
});
<?php $this->JQuery()->javascriptCaptureEnd()?>

<form action="<?php echo $this->escape($this->form->getAction()) ?>" method="<?php echo $this->escape($this->form->getMethod())?>"  enctype="multipart/form-data">
<fieldset>
          <legend><?php echo $this->t('Listing Detail');?></legend>
            <div class="required"><?php echo $this->t('Required Information')?></div>
            <div class="category desc">
                  <label><?php echo $this->t('Selected Categories')?>
                      <?php /*if (!isset($_GET['id'])):?>
                        (<a href="<?php echo $this->geturl('post-an-ad', 'listing', null, null, array('category' => $_GET['category'], 'change' => 1))?>">Change</a>)
                      <?php endif;*/?>
                      :
                  </label>
                  <ul>
                      <?php foreach($this->category as $cat):?>
                          <li>
                              <?php
                                $tmp = array();
                                foreach($cat->getParentTree() as $p) {
                                    $tmp[] = $p->name;
                                }
                                echo implode(' &gt; ', $tmp);
                              ?>
                          </li>
                      <?php endforeach;?>
                 </ul>
            </div>
            <input type="hidden" name="adid" id="adid" value="<?php echo $this->adid?>">
            <?php foreach($this->category as $cat):?>
                <input type="hidden" name="category[]" value="<?php echo $cat->_id?>">
            <?php endforeach;?>

            <div class="title text">
                  <label class="required"><?php echo $this->t('Title')?></label>
                  <span id="counter_title"><?php echo $this->t('<em>100</em> characters remaining')?></span>
                  <?php echo $this->form->title ?>
                  <?php if (!empty($_POST['title'])) { ?>
                  <?php if (preg_match("#.[a-z0-9._-]+@[a-z0-9._-]{2,}\.[a-z]{2,4}.#", $_POST['title'])) { ?>
                      <ul class="errors"><li><?php echo $this->t('Please remove email')?></li></ul>
                  <?php } } ?>
            </div>

            <div class="custom_info">
                <div class="custom_info_1">
                    <div class="gender select">
                        <label class="required"><?php echo $this->t('Gender')?></label>
                        <?php echo $this->form->gender ?>
                    </div>
                    <div class="employmenttype select">
                        <label class="required"><?php echo $this->t('Employment Type')?></label>
                        <?php echo $this->form->employmenttype ?>
                    </div>
                    <div class="salary price text">
                        <span  class="required"><?php echo $this->t('Salary per Month (Numbers only)')?></span>
                        <label><?php echo $this->t('HKD')?></label>
                        <label><?php echo $this->form->salary ?></label>
                    </div>
                    <div class="negotiable checkbox">
                        <?php echo $this->form->negotiable ?>
                        <label><?php echo $this->t('Negotiable')?></label>
                    </div>
                    <div class="joblocation select">
                        <label class="required"><?php echo $this->t('Job Location')?></label>
                        <?php echo $this->form->joblocation ?>
                    </div>                    
                </div>
                <div class="custom_info_2">
                    <div class="residentstatus select">
                        <label class="required"><?php echo $this->t('Resident Status')?></label>
                        <?php echo $this->form->residentstatus ?>
                    </div>
                    <div class="careerlevel select">
                        <label class="required"><?php echo $this->t('Career Level')?></label>
                        <?php echo $this->form->careerlevel ?>
                    </div>
                    <div class="jobcategory select">
                        <label class="required"><?php echo $this->t('Job Category')?></label>
                        <?php echo $this->form->jobcategory ?>
                    </div>
                    <div class="jobfunction select">
                        <label class="required"><?php echo $this->t('Job Function')?></label>
                        <?php echo $this->form->jobfunction ?>
                    </div>
                </div>
            </div>

            <div class="property_info_optional">
                <div class="description textarea">
                  <label class="required"><?php echo $this->t('Description')?></label>
                  <span id="counter_description2"><em>3000</em> <?php echo $this->t('characters remaining')?></span>
                  <?php echo $this->form->description?>
                </div>                
            </div>

            <div class="property_info_more button desc">
                <?php echo $this->form->add_more_checkbox?>
                <button id="add_more_btn"><?php echo $this->t('Add More')?></button>
                <p><?php echo $this->t('Click to "Add More" specifications to your Car Info')?></p>
            </div>

            <div class="property_info_more optional" id="add_more" style="display: none;">
                <div class="educationlevel select">
                    <label><?php echo $this->t('Education Level')?></label>
                    <?php echo $this->form->educationlevel;?>
                </div>
                <div class="yearexperience select">
                    <label><?php echo $this->t('Years of Experience')?></label>
                    <?php echo $this->form->yearexperience;?>
                </div>
                <div class="freshGrad checkbox">
                    <label><?php echo $this->form->freshgraduate;?></label>
                </div>
                <div class="companyBenefits  checkbox">
                    <span><?php echo $this->t('Company Benefits')?></span>
                    <?php echo $this->form->companybenefits;?>
                </div>   
            </div>
                

            <?php echo $this->Partial('/index/photo-uploader.phtml', 'listing', array('listing' => $this->listing));?>

            <div class="button_em">
                <button><?php echo $this->t('Post Your Ad')?></button>
            </div>
            <p class="preview button">
                <button id="preview_link"><?php echo $this->t('Preview Your Ad')?></button>
            </p>
  </fieldset>

</form>